package xiao.ke.activemq.service.impl;/**
 * @author XuXiaoK
 * @create 2019-11-27 11:48
 */


import javax.jms.Queue;
import javax.jms.Topic;


import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;
import xiao.ke.activemq.service.ProducerService;

/**
 * @Author XiaoKe
 * @Date 2019/11/27 11:48
 * @Description TODO
 */
@Service

public class ProducerServiceImpl implements ProducerService {

    @Autowired
    private Queue queue;

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;


    @Override
    public void sendMessage(javax.jms.Destination destination, String message) {

        System.out.println("xx");

        this.jmsMessagingTemplate.convertAndSend(destination, message);

    }

    @Override
    public void sendMessage(final String message) {

        jmsMessagingTemplate.convertAndSend(message);
    }

    @Autowired
    private Topic topic;

    @Override
    public void publish(String msg) {
        this.jmsMessagingTemplate.convertAndSend(this.topic, msg);
    }
}
